package com.church.daoimpl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.church.dao.NewpersonalityDao;
import com.church.db.Newpersonality;

public class NewpersonalityDaoImpl extends HibernateDaoSupport implements NewpersonalityDao {

	@Override
	public String add(Newpersonality newpersonality) {
		this.getHibernateTemplate().save(newpersonality);
		return "success";
	}

	@Override
	public String update(Newpersonality newpersonality) {
		this.getHibernateTemplate().update(newpersonality);
		return "success";
	}

	@Override
	public Newpersonality findById(int id) {
		List<Newpersonality> list = this.getHibernateTemplate().find("from Newpersonality where id="+id);
		if(list.size()>0)
		{
			return list.get(0);
		}
		return null;
	}

	@Override
	public List<Newpersonality> getList() {
		return this.getHibernateTemplate().find("from Newpersonality where state!='3'");
	}

}
